<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
  <meta name="author" content="zhupeng">
  
  <script language="javascript" src="/script/common.js" type="text/javascript"></script>
  <script language="javascript" type="text/javascript">	
	//调用认确制卡方法
	var asnLength = 16
	var taskAmount = getPara("taskAmount");
	var baseCardType = getPara("type");
	parent.dialog.hideBar();
	function onSave(){
		if(!checkForm("makeCard"))return;
	   	var id = getPara("id");
		//taskAmount = getPara("taskAmount");
		var lowerCardNumber = $("lowerCardNumber").value;
		var upperCardNumber = $("upperCardNumber").value
		if((upperCardNumber - lowerCardNumber + 1) != taskAmount){
			showWarning("入输的号段数量与制卡任务单数量不符");
			 return;
		}
	   	DWR.call("cardRequestService.confirmMakeCard",id,$("lowerCardNumber").value,$("makeCard").cardSpec.value,0,function(v){
			if(v){showInformation("确认成功!")}
	   		if(isIE()){
				parent.backValue(true);
		  	}
	   	},{blockScreen:true}); 
	}
	//计算号段长度
	function counter(cardNumber,countLength){
		var counters = $(cardNumber).value;    
		$(countLength).innerHTML = counters.length;
		if(counters.length == asnLength){
			$("makeCard").upperCardNumber.value = Number(counters) + Number(taskAmount) - 1;
			
			while($("upperCardNumber").value.length < asnLength){
				$("makeCard").upperCardNumber.value = "0"+$("upperCardNumber").value
			}
			
		}else{
			$("makeCard").upperCardNumber.value ="";
		}
	}
	function load(){
		asnLength = Project && Project.asnLength ? Project.asnLength : 16
		var form = $("makeCard")
		form.lowerCardNumber.maxLength = asnLength
		form.upperCardNumber.maxLength = asnLength
	}
	//选择卡片规格
	function selOrg(){
		var type;
		if(baseCardType == BaseCardType.PSAM){
			type = Constants.BLANK_CARD_TYPE_PSAM;
		}else{
			if (Project && Project.defPhysicalCardType)
				type = Project.defPhysicalCardType
			else
				type = Constants.BLANK_CARD_TYPE_BLANK;
		}
		var v = openDialogFrame("/store/sel_white_list.html?type="+type,'选择卡片规格',464,700)
	    if (v){
			var form=$("makeCard")
			    form.cardSpec.value=v.id;
				form.cardSpecName.value = v.name;
		}
	}
  </script>	
 </head>
<body onload="load()">
	<div id="goEnter">
		<form id="makeCard" name="makeCard"  action="">
			<input type="hidden" name="cardSpec">
			<div class="form">
				<div class="formTitle">确认制卡号段</div>
				<table cellSpacing=0 cellPadding=4 width="100%" border=0>
					<tr>
						<td><label>卡&nbsp;片&nbsp;&nbsp;规&nbsp;格:</label> <input type="text"  name="cardSpecName" readonly class="readonly" onblur="checkV(this,'',true)" ><a class=orga title="选择卡片规格" href="javascript:void(0)" onclick="selOrg()">&nbsp;&nbsp;</a><font class="des">*</font></td>
					</tr>
					<tr>
						<td><label>起始卡序列号:</label> <input type="text"  name="lowerCardNumber"   maxlength="16" onblur="if(checkDubleObjs($('makeCard').lowerCardNumber,$('makeCard').upperCardNumber,'asn','asn',true,true))compareValue($('makeCard').lowerCardNumber,$('makeCard').upperCardNumber,'ge','起始卡序列号','结束卡序列号');" onKeyUp="counter('lowerCardNumber','lowerCount');" ><label>当前输入长度:</label> <span id="lowerCount">0</span></td>
					</tr>
					<tr>
						<td><label>结束卡序列号:</label> <input type="text"  name="upperCardNumber"   maxlength="16" disabled class="readonly"></td>
					</tr>
				</table>
			</div>
				
		</form>
				<p align="center">
					<button type='button' id='saveBtn' name='saveBtn' onclick='onSave()'>确   认</button>&nbsp;&nbsp;&nbsp;<button type='button' onclick='window.close();' >取   消</button>
				</p>
	</div>
</body>
</html>
